﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092700608353";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD1+MAQiuCuvJlZyeWClQI7OuJjWU1zdeJNHp6lexOAxNplzPAU11mdLudJ+0Vxm1wqr7cwzmZMj9X0hnHZDhlJBO1WBqTmQZfv67eLUpiruqIcx6BIk1fzzCkouIx1zT9B0fpu5G5QP+WTLZ13Mm7xZcd72JEba8gidnJe43wzL5SEsj6GgTXDHMWp+IQvBYStREkFYqjTnvEu2TGghJLAyxr6WxKXQQX0PMTgspGyTZ56qbP+pq4+9xf2vFVPhzXhMCKM/mh0P2+MEc2n/gLHA9oyr43w48RqoETyEttpSvWdLj6vsLF83ErF1aKdzzBnlI3ulZ/LTu7GNY9g5KfHAgMBAAECggEBAOS1+ZDoMWcIwua0To4PE9YTOLH8NYIomNXwpL9mI4pWgGSsHIikfRUkqbcmxzmNpjOi04m0QXbrP5xw7qdO7r/wruaQov/e+fICkdYgZQk5Lsfn7ufM6bktmw/cGe7ne+wt3NkD2ncQEt25SnOtF2+qncRQaQzAOYWh8VK935yOzLS+DJ7nBr5kaFY1ErqdDUwn3U4woMeWp1YUvzi8GPtGDJKb8s6Clz3IMsaO3QgvpLCIEZpC54P4V5dMZgmeD59gtaR5rRlk5xz+8xNqIGzZAtWWRFTxWQCBC42a+dMDFBAlVTz+I/aDetOPJlLpEL/FVZIXMjXsGxPgwW0XvaECgYEA/JkltbGXkNg3sprvjklR78vWA0mtdqvM1bNxJqqOX1uM94D4KsRgUiuBtj6Si78NVl3geW7JvbacXVDAg2UdfH9C0m6FFQIo7bHIOZTKkgzK8o9+KahJ2rdAuF8jW/GoW7EjEVONAIE2qrHxoTEc/s+NhG/Y55PSMFAUwCIhc7kCgYEA+UjB48d2a8C+4mZ38DotCn6vjt0l4RV7SSkZqeUVwoJTeMsk02WHShgQhzciwW+fcFlLP7YDqk4hF+UkM+QgvUQ/81kHu6JXKrDh1r5Cn5bvsx9gxVaVXh6BuEDNzvEU/4Wmt58fZNdrgvXg/V/k3hVCOTIOtplPa2QfmByrt38CgYBnwOQLYHnYBefC1f8F27nrHDe4u/+jGegV8xHMBwxZwLoDQ5crweOqfLJX0BXTjtMEoaS9XDNDWImbjrq0fckBxSgGVV0Whv+Wuop6lFIscVK/FQ+GPtivHMxZrsJQVs+HchfsWvw0s95neJW+VvUI+Omw91wJqt8P9yS+0oYZCQKBgQC7XBTmRx9ZQ2f0r8FLm94Iekkm3k4/Cy87QJnaWKTvKZblPgGypSd25/lcN3N24Zd7EJH/E6VTlh9HX2DDY527wxUxqGOogg5ztrg2948JdZ85CMdp6nafY9xpiMNm20nF90Tj08P7vfE/X+A3b6CLznyUkmv+j+HiPEGGyV3CrwKBgAcLDqm2P1wfqJSBSEZi1osDJvFuQW52L3pbIFqxx6RQXABLEMEYyaxDsgj/1txdWt2zZYkV11kCMkR1+j7R92NEiM7F8b42BYSOeTOvi1WfQwnZ5HYHRgmvQE4aqBiYpic1SrOzEd9u7ruMr2KIbqyaYyeweePT8UU0ZGfow64O";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9fjAEIrgrryZWcnlgpUCOzriY1lNc3XiTR6epXsTgMTaZczwFNdZnS7nSftFcZtcKq+3MM5mTI/V9IZx2Q4ZSQTtVgak5kGX7+u3i1KYq7qiHMegSJNX88wpKLiMdc0/QdH6buRuUD/lky2ddzJu8WXHe9iRG2vIInZyXuN8My+UhLI+hoE1wxzFqfiELwWErURJBWKo057xLtkxoISSwMsa+lsSl0EF9DzE4LKRsk2eeqmz/qauPvcX9rxVT4c14TAijP5odD9vjBHNp/4CxwPaMq+N8OPEaqBE8hLbaUr1nS4+r7CxfNxKxdWinc8wZ5SN7pWfy07uxjWPYOSnxwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

